package cn.chencq.collection.set;

import cn.chencq.collection.map.MyHashMap2;

public class MyHashSet {

	private MyHashMap2 map;

	private static final Object PRESENT = new Object();

	public MyHashSet() {
		map = new MyHashMap2();
	}

	public int size() {
		return map.size();
	}

	public void add(Object o) {
		map.put(o, PRESENT); 
	}

	public void remove(Object o) {
		map.remove(o);
	}

	public boolean contains(Object o) {
		return map.containsKey(o);
	}

	public boolean isEmpty() {
		return map.isEmpty();
	}

	public static void main(String[] args) {
		MyHashSet set = new MyHashSet();
		set.add("aaa");
		set.add("abb");
		set.add("ccc");
		set.add("aaa");
		System.out.println(set.size());

		set.remove("ccc");
		System.out.println(set.size());
		
  	}
}
